﻿<Workspace
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
  xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
  xmlns="clr-namespace:agree;assembly=agree-sys"
  xmlns:cfg="clr-namespace:agree.configuration;assembly=agree-sys">

    <SysObj>
        <SysObj.DefaultDirectories>
            <StringItem>grammars</StringItem>
            <StringItem>grammars\copestake-book\itfs\g2agr</StringItem>
        </SysObj.DefaultDirectories>
    </SysObj>

    <Workspace x:Name="workspace1">

        <cfg:AgreeConfig x:Name="agree_config" Loader="{cfg:LkbConfigLoader globals.lsp}" />

        <TdlGroup x:Name="agree_TdlGroup">
            <Tdl Content="{ReadFile grammars\\copestake-book\\itfs\\g2agr\\types.tdl}" />
            <Tdl Content="{ReadFile grammars\\copestake-book\\itfs\\g2agr\\lexicon.tdl}"        TdlType="LexicalEntry" />
            <Tdl Content="{ReadFile grammars\\copestake-book\\itfs\\g2agr\\rules.tdl}"          TdlType="SyntaxRule" />
            <Tdl Content="{ReadFile grammars\\copestake-book\\itfs\\g2agr\\start.tdl}"          TdlType="StartSymbol" />
            <Tdl Content="{ReadFile grammars\\copestake-book\\itfs\\g2agr\\parse-nodes.tdl}"    TdlType="NodeLabel" />
        </TdlGroup>

        <TdlTokenizerFactory x:Name="tok_functor" AgreeConfig="{x:Reference agree_config}" >
            <TdlTokenizerFactory.TdlLetterSets>
                <PathRef Item="{x:Reference agree_TdlGroup}" Path="TdlLetterSets" />
            </TdlTokenizerFactory.TdlLetterSets>
        </TdlTokenizerFactory>

        <Grammar x:Name="g2agr"
                 AgreeConfig="{x:Reference agree_config}"
                 DisplayName="Toy grammar illustrating agreement g2agr"
                 Author="Ann Copestake (2001)" />

        <TypeDictionary x:Name="agree_td" Grammar="{x:Reference g2agr}" />

        <TypeLattice x:Name="agree_bcpo">
            <TypeGraphFinalizer>
                <TypeDictionaryLoader TypeDictionary="{x:Reference agree_td}">
                    <TdlConstraintGrouper TdlType="Type">
                        <TdlHashAggregator Functor="{x:Reference tok_functor}">
                            <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.Type}}">
                                <x:Reference Name="agree_TdlGroup" />
                            </Where>
                        </TdlHashAggregator>
                    </TdlConstraintGrouper>
                </TypeDictionaryLoader>
            </TypeGraphFinalizer>
        </TypeLattice>

        <FeatMgr x:Name="agree_ftm" TypeLattice="{x:Reference agree_bcpo}" />

        <GlbCache x:Name="agree_glbc" FeatMgr="{x:Reference agree_ftm}" />

        <TypeUtils x:Name="agree_tu" GlbCache="{x:Reference agree_glbc}" />

        <Isometrics x:Name="agree_im" TypeUtils="{x:Reference agree_tu}" />

        <TfsUnifier x:Name="agree_u" Isometrics="{x:Reference agree_im}" />

        <EntryMgr x:Name="agree_em"
                 TfsUnifier="{x:Reference agree_u}"
                 FeatMgr="{x:Reference agree_ftm}"
                 DefaultTokenizer="{x:Static SplitTokenizer.SpaceCharTokenizer}">

            <EntryMgr.SyntaxRuleTokenGroups>
                <TdlConstraintGrouper TdlType="SyntaxRule">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.SyntaxRule}}" >
                            <x:Reference Name="agree_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </EntryMgr.SyntaxRuleTokenGroups>

            <EntryMgr.LexicalEntryTokenGroups>
                <TdlConstraintGrouper TdlType="LexicalEntry">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.LexicalEntry}}">
                            <x:Reference Name="agree_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </EntryMgr.LexicalEntryTokenGroups>

            <EntryMgr.NodeLabelTokenGroups>
                <TdlConstraintGrouper TdlType="NodeLabel">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.NodeLabel}}">
                            <x:Reference Name="agree_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </EntryMgr.NodeLabelTokenGroups>

            <EntryMgr.StartSymbolTokenGroups>
                <TdlConstraintGrouper TdlType="StartSymbol">
                    <TdlHashAggregator Functor="{x:Reference tok_functor}">
                        <Where x:TypeArguments="Tdl" Functor="{TdlTypePred {x:Static TdlType.StartSymbol}}">
                            <x:Reference Name="agree_TdlGroup" />
                        </Where>
                    </TdlHashAggregator>
                </TdlConstraintGrouper>
            </EntryMgr.StartSymbolTokenGroups>
        </EntryMgr>
        <NodeLabeler x:Name="agree_nl"
                     EntryMgr="{x:Reference agree_em}"
                     TfsUnifier="{x:Reference agree_u}" />

        <Lexicon x:Name="agree_lex"
                 EntryMgr="{x:Reference agree_em}" />

        <!--MorphologyRules="{x:Reference agree_mph}" />-->

        <StringCorpus x:Name="test_sentences">
            <StringItem>This dog sleeps</StringItem>
            <StringItem>These dogs sleep</StringItem>
            <StringItem>The dog sleeps</StringItem>
            <StringItem>The dogs sleep</StringItem>
        </StringCorpus>

        <Composition x:Name="batch_parse">

            <Sequence>

                <x:Reference Name="test_sentences" />

                <WhitespaceSplitterF />

                <Factory x:TypeArguments="OrthLexentLookup">
                    <Setter Property="{x:Static P.Lexicon}" Value="{x:Reference agree_lex}" />
                </Factory>

                <Factory x:TypeArguments="VerifyCoverageLoader" />

                <!--<Factory x:TypeArguments="LexicalFilterLatticeBuilder" />

                <Factory x:TypeArguments="LexicalFilterExecutor">
                    <Setter Property="{x:Static P.EntryMgr}" Value="{x:Reference agree_em}" />
                    <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
                </Factory>-->

                <ChartObjLatticeExtractorF />

                <Factory x:TypeArguments="ParseControl">
                    <Setter Property="{x:Static P.AgreeConfig}" Value="{x:Reference agree_config}" />
                    <Setter Property="{x:Static P.ChartConfig}" Value="{PathRef {x:Reference agree_config}, Parser.Chart}" />
                    <Setter Property="{x:Static P.Grammar}" Value="{x:Reference g2agr}" />
                    <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
                    <Setter Property="{x:Static P.ChartStartSymbols}" Value="{PathRef {x:Reference agree_em}, ParserStartSymbols}" />
                </Factory>

                <!-- comment out the next two if using 'config-exec' (WPF) instead of 'console-exec' -->
                <Factory x:TypeArguments="UnpackLoader">
                    <Setter Property="{x:Static P.TfsUnifier}" Value="{x:Reference agree_u}" />
                </Factory>

            </Sequence>
        </Composition>
    </Workspace>
</Workspace>
